package com.cwj.blog.module.home

import com.cwj.blog.base.BaseObserver
import com.cwj.blog.base.BasePresenter
import com.cwj.blog.bean.BlogBean

/**
 * created by cwj on 2024-1-10
 * Description:
 */
class HomePrensenter(baseView: HomeView?) : BasePresenter<HomeView?>(baseView) {
    fun page(skip: Int?, pageSize: Int?, title: String?, type: Int?) {
        addDisposable(apiServer.page(skip, pageSize, title), object : BaseObserver<BlogBean?>() {
            override fun onSuccess(o: BlogBean?) {
                if (o!!.code == 200) {
                    baseView!!.pageData(o, type)
                } else {
                    baseView!!.error(o.msg)
                }
            }

            override fun onError(msg: String) {
                baseView!!.error(msg)
            }
        })
    }
}